 {extend name="layout:base" /}{block name="content"}

 <?php
$global=isSupperManagerForSession();
 ?>
 <link rel="stylesheet" type="text/css" href="/static/My97DatePicker/skin/WdatePicker.css" />
     <script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
  .yg_inp>input{margin-bottom: 10px;}
#zc_detail table{margin:10px;}
#zc_detail table tr td{
	border: 1px solid #ddd;
	height:40px;
	line-height:40px;
	padding-left:5px;
	padding-right:5px;
} 
.ordertable input {width:90%;}
.policeLable{padding:2px 4px;margin-left:4px;}
#taskDate .taskDateItem{
	width:100%;height:40px;line-height:40px;margin:4px 0px;
}
#taskDate .taskDateItem .taskDateItemLeft{width:10%;float:left;}
#taskDate .taskDateItem .taskDateItemRight1{width:70%;float:left;border:1px solid #139667;height: 42px;}
#taskDate .taskDateItem .taskDateItemRight2{width:20%;float:right;}
#taskDate .taskDateItem .opUsers img{width:22px;margin-left:5px;}

#taskDate .taskDateItem .itemUser{padding: 4px 6px;background:#139667;margin-left:4px;color:white;}
#taskDate .taskDateItem .clear{clear:both;width:0px;height:0px;overflow:hidden;}
#taskDate .taskDateItem .jia,#taskDate .taskDateItem .jian{font-size:30px;cursor:pointer;font-weight:800;margin-left:5px;}

</style>

<!--引入JS-->
<script type="text/javascript" src="/static/admin/js/ajaxfileupload.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>


<section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
        <span data-url="/admin/news/lists" onclick="ContentLoadGo('/admin/news/lists')">新闻管理</span>
         >
         <span data-url="/admin/news/editData"  onclick="ContentLoadGo('/admin/news/editData?id=<?php echo $id; ?>')"  >新闻编辑</span>
         
         </div>
      </section>
 <section id="zc_detail">

      <input type="hidden" value="<?php echo $id; ?>" id="editId" />
     
   <table class="ordertable" border="0" cellspacing="0" style="width:100%;" cellpadding="0">

	
     <tr>
       
       <td width="120"><div align="right">新闻标题</div></td>
       <td class="tr_cons">
       <input type="text" name="e-title" id="e-title" value="<?php echo $info['title']; ?>" placeholder="新闻标题" class="textbox" style="padding:0px;" />
       </td>
     </tr>
     
     <tr>
     
       <td width="120"><div align="right">新闻栏目</div></td>
       <td  class="tr_cons">
      		<select name="e-ty" id="e-ty" class="select">
      		<option value="0">--栏目--</option>
      		   <?php
      		    foreach($allType as $key=>$val)
				{
				?>
				<option value="<?php echo $val['id'] ?>" <?php if($val['id']==$info['ty']){echo 'selected';} ?> ><?php echo $val['name']; ?></option>
				<?php
				}
      		    ?>
      		</select>
       </td>
       </tr>
     
      <tr>
         <td><div align="right">封面图</div></td>
         <td colspan="7">
         <form id="jvForm" action="/api/face/updateImage1" method="post" enctype="multipart/form-data">
            <input type="hidden" name="e-mpic" id="e-mpic" value="<?php echo $info['pic'] ?>" />
                <a style="position:relative;display:block;width:100px;height:30px;background:#EEE;border:1px solid #999;text-align:center;line-height:30px;"  href="javascript:void(0);" >上传文件
                <input style="position:absolute;left:0;top:0;width:100px;height:30px;z-index:999;opacity:0;" onchange="uploadPic()" type="file" name="file" id="file"  />
                </a>
            <div id="updateimg">
            <?php
            if($info['pic'])
			{
			?>
            <a href="<?php echo $info['pic']; ?>" target="_blank"><img src="<?php echo $info['pic']; ?>" style="width:120px;margin:5px;" /></a>
            <?php
            }
			else
			{
				
			}
			?>
            </div>
            </form>
         </td>
      </tr>
      <tr>
         <td><div align="right">视频</div></td>
         <td colspan="7">
         <form id="jvFormV" id="jvFormV" action="/api/face/updateImage1" method="post" enctype="multipart/form-data">
            <input type="hidden" name="e-mpicV" id="e-mpicV" value="<?php echo $info['video'] ?>" />
                <a style="position:relative;display:block;width:100px;height:30px;background:#EEE;border:1px solid #999;text-align:center;line-height:30px;"  href="javascript:void(0);" >上传视频
                <input style="position:absolute;left:0;top:0;width:100px;height:30px;z-index:999;opacity:0;" onchange="uploadPicV()" type="file" name="file" id="fileV"  />
                </a>
                <div id="uploadProgress"></div>
            <div id="updateimgV">
            <?php
            if($info['video'])
			{
			?>
            <a href="<?php echo $info['video']; ?>" target="_blank"><?php echo $info['video']; ?></a>
            <?php
            }
			else
			{
				
			}
			?>
            </div>
            </form>
         </td>
      </tr>
     
     
      <tr>
         <td><div align="right">摘要</div></td>
         <td colspan="7">
            <textarea name="e-desc" id="e-desc" cols="60" rows="2" style="margin-top:2px;"><?php echo $info['desc']; ?></textarea>
            <div style="font-size:14px;color:red;">提示：不能够超过200个字</div>
         </td>
      </tr>
      
      <tr>
         <td><div align="right">内容</div></td>
         <td colspan="7">
            <script id="editor" type="text/plain" style="width:96%;height:500px;"><?php echo $info['conts']; ?></script>
         </td>
      </tr>
         <tr>
         <td><div align="right">是否推荐</div></td>
         <td colspan="7">
              <select name="e-tuijian" id="e-tuijian" class="select">
              	<option value="0" <?php if($info['tuijian']=='0'){echo 'selected';} ?> >普通</option>
              	<option value="1" <?php if($info['tuijian']=='1'){echo 'selected';} ?> >推荐</option>
              </select>
         </td>
      </tr>
     <tr>
       <td colspan="2" style="height:50px;text-align:center;">
			<input type="button" power="70000"  style="width:80px;margin-top:4px;margin-bottom:4px;padding:0px;" value="编辑" class="link_btn edit"/>
       </td>
     </tr>
     
     
   </table>

     </section>
<script type="text/javascript">
 var ue = UE.getEditor('editor').addListener("ready", function () {});
</script>

       <script type="text/javascript">

       function uploadPic()
       {
    	
    		 $.ajaxFileUpload(
    		   {
	    		   	url: '/api/face/uploadImage1', //用于文件上传的服务器端请求地址
	    		   	secureuri: false, //是否需要安全协议，一般设置为false
	    		   	fileElementId: 'file', //文件上传域的ID
	    		   	dataType: 'text/plain', //返回值类型 一般设置为json
	    		   	success: function (data, status) //服务器成功响应处理函数
	    		   	{
	    		   	 if(data.err==0)
	                   {
	                	   var img='<a href="'+data.data.pic+'" target="_blank"><img src="'+data.data.pic+'" style="width:120px;margin:5px;" /></a>';
	                   $("#updateimg").html(img);
	                   $("#e-mpic").val(data.data.pic);
	                   }
	    		   },
	    		   error: function (data, status, e)//服务器响应失败处理函数
	    		   {
	    		   	alert(e);
	    		   }
    		   }
    		 )
    		   return false;
    		   
       }
       function uploadPicV()
       {
    	   $("#uploadProgress").html("<img  src='/static/admin/images/loading.gif' style='width:50px;' />");
    		 $.ajaxFileUpload(
    		   {
	    		   	url: '/api/face/uploadImage1', //用于文件上传的服务器端请求地址
	    		   	secureuri: false, //是否需要安全协议，一般设置为false
	    		   	fileElementId: 'fileV', //文件上传域的ID
	    		   	dataType: 'text/plain', //返回值类型 一般设置为json
	    		   	success: function (data, status) //服务器成功响应处理函数
	    		   	{
	    		   	 if(data.err==0)
	                   {
	                	   var img='<a href="'+data.data.pic+'" target="_blank">'+data.data.pic+'</a>';
	                   $("#updateimgV").html(img);
	                   $("#e-mpicV").val(data.data.pic);
	                   }
	    		   	$("#uploadProgress").html("");
	    		   },
	    		   error: function (data, status, e)//服务器响应失败处理函数
	    		   {
	    			   $("#uploadProgress").html("异常");
	    		   }
    		   }
    		 )
    		   return false;
    		   
       }
       function uploadPic1() {  

 	      // 上传设置  

 	      var options = {  
 	                url: "/api/face/uploadImage",  
 	                type: "post",  
 	                // 服务器响应的数据类型  
 	                dataType: "json",  
 	                // 请求成功时执行的回调函数  
 	                success: function(data, status, xhr) {  
 	                   if(data.err==0)
 	                   {
 	                	   var img='<a href="'+data.data.pic+'" target="_blank"><img src="'+data.data.pic+'" style="width:120px;margin:5px;" />';
 	                   $("#updateimg").html(img);
 	                   $("#e-mpic").val(data.data.pic);
 	                   }
 	                }  

 	        };  
 	        $("#jvForm").ajaxSubmit(options);  
 	    } 
      function myResearch(){
		   var url="/admin/news/editData";
		   var id=$("#editId").val();
		 
		   ContentLoadGo(url+"?id="+id);
		   
	   }
    
      
           $(function(){
        	   var gnum=0;
        	   var lastObj;
        
        	   
			
          	//编辑项
          	    $(".edit").unbind().bind("click",function(){
          	    	
          	     var that =this;
           		 var url="/admin/news/editData";
           		 var title=$("#e-title").val();
           		 var ty=$("#e-ty").val();
           	     var pic=$("#e-mpic").val();
           	     var id=$("#editId").val();
                 var desc=$("#e-desc").val();
                 var conts=UE.getEditor('editor').getContent();
                 var tuijian=$("#e-tuijian").val();
                 var video=$("#e-mpicV").val();
        		if(title=="")
         		{
         			ErrTiShi("新闻标题不能够为空");return false;
         		}
        		 
        		if(ty=="" || ty=="0")
         		{
         			ErrTiShi("新闻栏目不能够为空");return false;
         		}
        		
        		if(conts=="")
         		{
         			ErrTiShi("新闻内容不能够为空");return false;
         		}
        		if(desc.length>=200)
        	    {
        			ErrTiShi("新闻摘要不能够超过200个字");return false;
        	    }
           	
        		
        		var param={
            		    title:title,
            		    ty:ty,
            		    pic:pic,
            		    desc:desc,
            		    conts:conts,
            		    id:id,
            		    tuijian:tuijian,
            		    video:video,
    				    sys_opt:'editData'//后台判断编辑操作
    		        };
           		//alert(JSON.stringify(param));return false;
           		    
        			 AjaxRequest(url,param,function(data){
          			   if(data.err==0)
          			   {
          				   SuccessTiShi("操作成功");
          				  
          				 myResearch();
          			   }
          			   else
          			   {
          				   ErrTiShi(data.msg);
          			   }
          		   	});
          			
          	   });
        	   
          	 
        	
  		
  				$("#all").click(function(){   
			    	if(this.checked){   
			        	$(".checkBoxInput").attr("checked", true);  
			        	$(".checkBoxInput").prop("checked", true);  
			    	}else{   
						$(".checkBoxInput").attr("checked", false);
						$(".checkBoxInput").prop("checked", false);
			    	}   
			    	var se=getAllSelectItem();
			    	//console.log(se);
			 	}); 
  				 //导航
         	   $(".topBannerItem").click(function(){
         		   
         		   var attArr = $(this).attr();
             	   goToSelfLink(attArr);
             	   
         			
         	   });
  			   
  				
           });
           
	  </script>
	  	  
	  {/block}
	  